package com.slipper.login;

import com.slipper.groovy.service.GroovyService;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class GroovyLoginStrategy implements ILoginStrategy {
    @Override
    public boolean supports(String type) {
        return LoginType.GROOVY.equals(type);
    }

    @Override
    public Object login(Map<String, Object> paramMap) {
        return GroovyService.runById((String) paramMap.get("groovyScriptId"), paramMap);
    }
}
